package com.ica.model.command.util;

import java.util.Iterator;

import com.ica.model.contact.Contact;
import com.ica.model.contact.ContactGroup;

import android.telephony.SmsManager;

/**
 * @author   Hector
 */
public class SmsManagerAdaptor {
	
	/**
	 */
	private SmsManager smsManager = null;
	
	/**
	 * @return
	 * @uml.property  name="smsManager"
	 */
	private SmsManager getSmsManager() {
		if (smsManager==null) {
			smsManager = SmsManager.getDefault();
		}
		return smsManager;
	}
	
	public void sendSms(ContactGroup receiver, String body) {		
		Iterator<Contact> it = receiver.getContacts();
		while(it.hasNext()) {
			getSmsManager().sendTextMessage(it.next().getPhoneNumber(), null, body, null, null);
		}
	}

}
